table of contents
CREATE COLLATION(7) | PostgreSQL 9.2.24 Documentation | CREATE COLLATION(7) |
NAME¶
CREATE_COLLATION - define a new collation
SYNOPSIS¶
CREATE COLLATION name (
[ LOCALE = locale, ]
[ LC_COLLATE = lc_collate, ]
[ LC_CTYPE = lc_ctype ] ) CREATE COLLATION name FROM existing_collation
DESCRIPTION¶
CREATE COLLATION defines a new collation using the specified operating system locale settings, or by copying an existing collation.
To be able to create a collation, you must have CREATE privilege on the destination schema.
PARAMETERS¶
name
locale
lc_collate
lc_ctype
existing_collation
NOTES¶
Use DROP COLLATION to remove user-defined collations.
See Section 22.2, “Collation Support”, in the documentation for more information about collation support in PostgreSQL.
EXAMPLES¶
To create a collation from the operating system locale fr_FR.utf8 (assuming the current database encoding is UTF8):
CREATE COLLATION french (LOCALE = 'fr_FR.utf8');
To create a collation from an existing collation:
CREATE COLLATION german FROM "de_DE";
This can be convenient to be able to use operating-system-independent collation names in applications.
COMPATIBILITY¶
There is a CREATE COLLATION statement in the SQL standard, but it is limited to copying an existing collation. The syntax to create a new collation is a PostgreSQL extension.
SEE ALSO¶
ALTER COLLATION (ALTER_COLLATION(7)), DROP COLLATION (DROP_COLLATION(7))
2017-11-06 | PostgreSQL 9.2.24 |